/*    */ package com.zimbra.cs.index.query;
/*    */ 
/*    */ import com.zimbra.cs.index.DBQueryOperation;
/*    */ import com.zimbra.cs.index.QueryOperation;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import org.apache.lucene.analysis.Analyzer;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public final class SenderQuery
/*    */   extends Query
/*    */ {
/*    */   private final String sender;
/*    */   private final Query.Comparison comparison;
/*    */   
/*    */   private SenderQuery(String text)
/*    */   {
/* 41 */     if (text.startsWith(Query.Comparison.LE.toString())) {
/* 42 */       this.comparison = Query.Comparison.LE;
/* 43 */     } else if (text.startsWith(Query.Comparison.LT.toString())) {
/* 44 */       this.comparison = Query.Comparison.LT;
/* 45 */     } else if (text.startsWith(Query.Comparison.GE.toString())) {
/* 46 */       this.comparison = Query.Comparison.GE;
/* 47 */     } else if (text.startsWith(Query.Comparison.GT.toString())) {
/* 48 */       this.comparison = Query.Comparison.GT;
/*    */     } else {
/* 50 */       throw new IllegalArgumentException(text);
/*    */     }
/* 52 */     this.sender = text.substring(this.comparison.toString().length());
/*    */   }
/*    */   
/*    */   public static Query create(Analyzer analyzer, String text) {
/* 56 */     if ((text.length() > 1) && ((text.startsWith(Query.Comparison.LT.toString())) || (text.startsWith(Query.Comparison.GT.toString()))))
/*    */     {
/* 58 */       return new SenderQuery(text);
/*    */     }
/* 60 */     return new TextQuery(analyzer, "from", text);
/*    */   }
/*    */   
/*    */ 
/*    */   public boolean hasTextOperation()
/*    */   {
/* 66 */     return false;
/*    */   }
/*    */   
/*    */   public QueryOperation compile(Mailbox mbox, boolean bool)
/*    */   {
/* 71 */     DBQueryOperation op = new DBQueryOperation();
/* 72 */     switch (this.comparison) {
/*    */     case LE: 
/* 74 */       op.addSenderRange(null, false, this.sender, true, evalBool(bool));
/* 75 */       break;
/*    */     case LT: 
/* 77 */       op.addSenderRange(null, false, this.sender, false, evalBool(bool));
/* 78 */       break;
/*    */     case GE: 
/* 80 */       op.addSenderRange(this.sender, true, null, false, evalBool(bool));
/* 81 */       break;
/*    */     case GT: 
/* 83 */       op.addSenderRange(this.sender, false, null, false, evalBool(bool));
/* 84 */       break;
/*    */     default: 
/* 86 */       if (!$assertionsDisabled) throw new AssertionError(this.comparison);
/*    */       break; }
/* 88 */     return op;
/*    */   }
/*    */   
/*    */   public void dump(StringBuilder out)
/*    */   {
/* 93 */     out.append("SENDER:").append(this.comparison).append(this.sender);
/*    */   }
/*    */   
/*    */   public void sanitizedDump(StringBuilder out)
/*    */   {
/* 98 */     out.append("SENDER:").append(this.comparison).append("$TEXT");
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/index/query/SenderQuery.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */